package com.yequan.hbb.view.fragment;


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.yequan.hbb.R;
import com.yequan.hbb.adapter.QuesFragmentAdapter;
import com.yequan.hbb.adapter.TuanFragmentAdapter;
import com.yequan.hbb.customview.DrawableCenterTextView;
import com.yequan.hbb.view.fragment.tuantuan_page_fragment.HelpChoseFragment;
import com.yequan.hbb.view.fragment.tuantuan_page_fragment.HelpSaveFragment;

import java.util.ArrayList;

/**
 * A simple {@link Fragment} subclass.
 */
public class TuantuanFragment extends Fragment {


    public TuantuanFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_tuantuan, container, false);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        TabLayout tab = (TabLayout) view.findViewById(R.id.tuantuan_tab);
        ViewPager pager = (ViewPager) view.findViewById(R.id.tuantuan_pager);
        ((DrawableCenterTextView) view.findViewById(R.id.wl_tool_bar_search)).setText("搜索");
        // QuesFragmentAdapter adapter = new QuesFragmentAdapter(getChildFragmentManager(), view.getContext());
       // pager.setAdapter(adapter);
        HelpChoseFragment helpChoseFragment = new HelpChoseFragment();
        HelpSaveFragment helpSaveFragment = new HelpSaveFragment();
        ArrayList<Fragment> list = new ArrayList<>();
        list.add(helpChoseFragment);
        list.add(helpSaveFragment);
        TuanFragmentAdapter adapter = new TuanFragmentAdapter(getChildFragmentManager(), list);
        pager.setAdapter(adapter);
        tab.setupWithViewPager(pager);


    }
}
